#include "StdAfx.h"
#include "Object.h"

Object::Object(void)
{
	worldMatrix.SetIdentity();
}

Object::~Object(void)
{
}


void Object::moveLeft()
{
	translationMatrix.SetTranslation(-TRANSLATE_STEP, 0, 0);
	move();
}
void Object::moveRight()
{
	translationMatrix.SetTranslation(TRANSLATE_STEP, 0, 0);
	move();
}
void Object::moveForward()
{
	translationMatrix.SetTranslation(0, 0, TRANSLATE_STEP);
	move();
}
void Object::moveBackward()
{
	translationMatrix.SetTranslation(0, 0, -TRANSLATE_STEP);
	move();
}

void Object::RotateLeft()
{
	rotationMatrix.SetRotationY(-ROTATE_STEP);
	rotate();
}
void Object::RotateRight()
{
	rotationMatrix.SetRotationY(ROTATE_STEP);
	rotate();
}
void Object::RotateUp()
{ 
	rotationMatrix.SetRotationX(ROTATE_STEP);
	rotate();
}
void Object::RotateDown()
{
	rotationMatrix.SetRotationX(-ROTATE_STEP);
	rotate();
}

void Object::move()
{
	//position = Vector4(position, 1) * translationMatrix * worldMatrix;
	worldMatrix = worldMatrix * translationMatrix;
}

void Object::rotate()
{
	//position = Vector4(position, 1) * rotationMatrix * worldMatrix;
	worldMatrix = worldMatrix * rotationMatrix;
}